﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

namespace DataShow.codeBLL
{
    public class RankBLL
    {
        #region 获得一般排序
        /// <summary>
        /// 获得一般排序
        /// </summary>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <returns></returns>
        public string GetNormalRank(string year, string month)
        {
            return new codeDAL.RankProcess().GetNormalRank(year, month);
        } 
        #endregion

        #region 预报员id转成json
        /// <summary>
        /// 预报员用户名转成json
        /// </summary>
        /// <returns></returns>
        public string GetForecastersID2Json()
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            StringBuilder sb = new StringBuilder();
            DataTable dt = new codeDAL.RankProcess().GetAllForecasters();
            List<string> ids = new List<string>();
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ids.Add((dt.Rows[i]["username"].ToString()));
                }
            }
            jss.Serialize(ids, sb);
            return sb.ToString();
        } 
        #endregion
    }
}